const Router = require('@koa/router');
// Koa 的路由在被 use 时是无法指定前缀的, 需要在定义时就指定前缀
const router = Router({
    prefix: '/api/todayPlan'
});

const todayPlanController = require('../controllers/todayPlanController1');

// 组装路由
router.get('/', todayPlanController.listAll);
router.get('/:id', todayPlanController.getOneById);
router.post('/', todayPlanController.add);
router.put('/', todayPlanController.updateOneById);
router.delete('/:id', todayPlanController.deleteById);
router.post('/queryPage', todayPlanController.queryPage);

// Koa 的路由需要调用 routes 函数获取实际用于 use 的函数
module.exports = router.routes();
